package com.sun.designPattern.Observer.ProjectImp;

import java.util.Observable;
import java.util.Observer;

public class TstObServer implements Observer{
	
	@Override
	public void update(Observable observ, java.lang.Object o) {
		EntityEventBlock eeb = (EntityEventBlock) observ;
		System.out.println("捕获业务对象变动数 = "+ eeb.getChangeEvents().size());
		for (EntityChangeEvent event : eeb.getChangeEvents()) {
			System.out.println("entityCls:[" + event.getEntityCls() + "]"
					+ ",id:[" + event.getId() + "]"
					+ ",变动类型:[" + (event.getType() == EntityChangeEvent.TYPE_ADD ? "新增" :
							event.getType() == EntityChangeEvent.TYPE_UPDATE ? "更新" :
							event.getType() == EntityChangeEvent.TYPE_DELETE ? "删除" : "") + "]");
		}
	}

}
